<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>2. Extension Attributes</title>
      <meta charset="utf-8" />
      <meta name="generator" content="DocBook XSL 2.0 Stylesheets V2.5.0" />
      <link href="css/default.css" rel="stylesheet" type="text/css" />
      <link href="css/db-prism.css" rel="stylesheet" type="text/css" />
      <link rel="stylesheet" href="css/xproc.css" type="text/css" /><script type="text/javascript" src="js/dbmodnizr.js"></script></head>
   <body>
      <div class="page">
         <div class="content">
            <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="navheader">
               <table border="0" cellpadding="0" cellspacing="0" width="100%" summary="Navigation table">
                  <tr>
                     <td align="left"> <a title="XML Calabash Reference" href="index.html"><img src="img/home.png" alt="Home" border="0" /></a> <a href="extprop.html" title="1 .  System property extensions"><img src="img/prev.png" alt="Prev" border="0" /></a> <a title="Chapter  5 .  Extensions" href="extensions.html"><img src="img/up.png" alt="Up" border="0" /></a> <a title="3 .  Language Extensions" href="langext.html"><img src="img/next.png" alt="Next" border="0" /></a></td>
                     <td align="right"><i>XML Calabash Reference</i> (Version 0.28)</td>
                  </tr>
               </table>
            </div>
            <div class="body">
               <section id="extattr" class="section">
                  <div class="section-titlepage">
                     <h2>2. Extension Attributes</h2>
                  </div>
                  <div class="content">
                     <p><em class="citetitle">XML Calabash</em> supports several extension
                        attributes.</p>
                     <section id="cx-depends-on" class="section">
                        <div class="section-titlepage">
                           <h3>2.1. <code class="tag-attribute">cx:depends-on</code></h3>
                        </div>
                        <div class="content">
                           <p>The
                              <code class="tag-attribute">cx:depends-on</code> attribute provides finer grained control
                              over the dependencies between steps. Consider the following example:</p>
                           <div id="cx-depends-on.3" class="mediaobject"><img src="img/depends.png" /></div>
                           <p>Because step “C” depends on steps “A” and “B”, you can be sure
                              that step “C” will run after “A” and “B”. (If Calabash was a
                              multi-threaded, streaming implementation, the constraint would be
                              weaker.) But what about steps “A” and “B”?</p>
                           <p>Because neither step depends (directly or indirectly) on the output
                              of the other, there is no guarantee about the order in which they will
                              be evaluated.</p>
                           <p>If step “B” relies on some side effect of step “A” (perhaps “A” calls
                              a web service or writes a document to disk and “B” relies on this having already
                              happened for its correct operation), then you need a way to force the ordering.</p>
                           <p>It's best if this can be accomplished by establishing an input/output dependency,
                              reading an output of “A” in the evaluation of “B”.</p>
                           <p>However, if you can't easily arrange an input/output dependency and you're not
                              concerned about introducing an implementation dependency into your pipeline, you
                              can establish the relationship directly by adding</p>
                           <pre class="programlisting language-none line-numbers"><code>cx:depends="A"</code></pre>
                           <p>as an extension attribute on “B”. That informs <em class="citetitle">XML Calabash</em>
                              that the evaluation of “A” <em>must</em> precede the evaluation
                              of “B”. The value of <code class="tag-attribute">cx:depends</code> is a space-separated
                              list of step names.</p>
                           <p>It is an error if the use of <code class="tag-attribute">cx:depends</code> introduces
                              a circular dependency into the pipeline.</p>
                        </div>
                     </section>
                     <section id="cx-message" class="section">
                        <div class="section-titlepage">
                           <h3>2.2. <code class="tag-attribute">cx:message</code></h3>
                        </div>
                        <div class="content">
                           <p>As of version 1.1.11, you can add a <code class="tag-attribute">cx:message</code>
                              attribute to any step. The message will be printed when the step begins
                              running.</p>
                        </div>
                     </section>
                     <section id="cx-logstyle" class="section">
                        <div class="section-titlepage">
                           <h3>2.3. <code class="tag-attribute">cx:logstyle</code></h3>
                        </div>
                        <div class="content">
                           <p>The
                              <code class="tag-attribute">cx:logstyle</code> attribute can only be used on
                              the <code class="tag-element">p:log</code> element. It controls how the logged document(s) will
                              be written. There are four options:</p>
                           <div class="variablelist">
                              <dl>
                                 <dt><span class="term">plain</span></dt>
                                 <dd>
                                    <p>Document(s) will be written to the specified file, one after another
                                       with no separation. The resulting file will not be well-formed XML if more
                                       than one document is logged.
                                       </p>
                                 </dd>
                                 <dt><span class="term">wrapped</span></dt>
                                 <dd>
                                    <p>The specified file will contain a <code class="tag-element">px:document-sequence</code>.
                                       Each document written will be wrapped in a <code class="tag-element">px:document</code> element.
                                       The resulting file will be well-formed XML.
                                       </p>
                                 </dd>
                                 <dt><span class="term">directory</span></dt>
                                 <dd>
                                    <p>The specified location must be a directory. Each logged document
                                       will be written to its own file.
                                       </p>
                                 </dd>
                                 <dt><span class="term">off</span></dt>
                                 <dd>
                                    <p>Does nothing. This is the equivalent of removing the <code class="tag-element">p:log</code>
                                       element.
                                       </p>
                                 </dd>
                              </dl>
                           </div>
                        </div>
                     </section>
                  </div>
               </section>
            </div>
         </div>
         <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="navfooter">
            <table width="100%" summary="Navigation table">
               <tr>
                  <td width="40%" align="left"><a title="1 .  System property extensions" href="extprop.html"><img src="img/prev.png" alt="Prev" border="0" /></a> </td>
                  <td width="20%" align="center"><a title="XML Calabash Reference" href="index.html"><img src="img/home.png" alt="Home" border="0" /></a></td>
                  <td width="40%" align="right"> <a title="3 .  Language Extensions" href="langext.html"><img src="img/next.png" alt="Next" border="0" /></a></td>
               </tr>
               <tr>
                  <td width="40%" align="left">1 .  System property extensions </td>
                  <td width="20%" align="center"><a title="Chapter  5 .  Extensions" href="extensions.html"><img src="img/up.png" alt="Up" border="0" /></a></td>
                  <td width="40%" align="right"> 3 .  Language Extensions</td>
               </tr>
            </table>
         </div>
         <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="copyrightfooter">
            <p><a href="dbcpyright.html">Copyright</a> © 2011–2020 Norman Walsh.</p>
         </div>
      </div>
   </body>
</html>